<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/share/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <title>角色权限</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<%@ include file="/WEB-INF/share/easyuilist.jsp"%>
    <script type="text/javascript">
	    var roleId = request('id');
	    $(function () {
	        buttonOperation();
	        GetModuleTree();
	    })
	    //获取系统功能
	    function GetModuleTree() {
	        var item = {
	            height: 540,
	            showcheck: true,
	            url: "${ctx}/role/NaviRoleTree?roleId=" + roleId
	        };
	        $("#ModuleTree").treeview(item);
	    }
	    function buttonOperation() {
	        var $finish = $("#btn_finish");
	        //完成提交保存
	        $finish.click(function () {
	            var postData = $("#form1").GetWebControls();
	            postData["roleID"] = roleId;
	            postData["ids"] = String($("#ModuleTree").getCheckedAllNodes());
	            $.SaveForm({
	                url: "${ctx}/role/navisave",
	                param: postData,
	                loading: "正在保存角色授权...",
	                success: function () {
	                    $.currentIframe().$("#gridTable").trigger("reloadGrid");
	                }
	            })
	        })
	    }
	</script>
</head>
<body>
<form id="form1">
	<input id="roleid" value="${roleid}" type="hidden"/>
	<div class="widget-body">
    	<div id="ModuleTree" style="margin-left: 10px;"></div>
    </div>
	<div class="form-button" id="wizard-actions">
    	<a id="btn_finish" class="btn btn-success">完成</a>
	</div>
</form>
</body>
</html>
